import java.util.ArrayList;

public class Circle extends Shape 
{
	private final Point center;
	private final double radius;
	
	public Circle(Point center, Double radius)
	{
		if (center == null || radius <0)
		{
			throw new IllegalArgumentException();
		}
		
		this.center=center;
		this.radius=radius;
	}
	@Override
	public double getArea()
	{
		return Math.pow(radius, 2.0d)*Math.PI;
	}
	
	@Override
	public double getPerimeter()
	{
		return 2*Math.PI*radius;
	}
	
	@Override
	public ArrayList<Point> getSequenceOfPointsToDraw()
	{
		ArrayList<Point> points = new ArrayList<Point>();
		
		int numberOfSegment = 256;
		
		for (int i=0; i<numberOfSegment; i++)
		{
			double newPointX = center.getX() + radius * Math.cos(2*Math.PI*i/numberOfSegment);
			double newPointY = center.getY() + radius * Math.sin(2*Math.PI*i/numberOfSegment);
			points.add(new Point(newPointX, newPointY));
			
		}
		
		return points;
	}
	
	@Override
	public void draw(TwoDimensionalCanvas canvas)
	{
		canvas.drawCircle(center, radius);
		
	}
}
